<template>
	<view >
		<view class="custombar"  :class="scroll >40 ?'backg' : ''"  :style="{height:(statusBarHeight+navHeight)+'px'}">
			<view class="status_bar" :style="{height:statusBarHeight+'px'}"></view>
			<view class="nav_bar" :style="{height:navHeight+'px'}">
				<slot></slot>
			</view>
		</view>

	</view>

</template>

<script>
	 
	const app = getApp(); 
	export default {
		name: "bar",
		data() {
			return {
				statusBarHeight: app.globalData.statusBarHeight,
				navHeight: app.globalData.navHeight
			};
		},
		props:{
			
			scroll:{
				type:Number,
				default:0
			}
		},
		created() {
			const demo = uni.getMenuButtonBoundingClientRect();
			this.paddingTop = demo.top;
			// 状态栏高度
			const statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
			// 导航栏高度(标题栏高度)一般都为44px，所以我这里直接使用44
			// 总体高度 = 状态栏高度 + 导航栏高度
			this.height = (statusBarHeight + 44) * 2 + 'rpx'
		},
		onShow() {
		
		},
		
		methods: {
			goback(){
				uni.navigateBack({
					delta:1
				})
			}, 
			gopage(){
			    uni.switchTab({
			    	url:'/pages/index/index'
			    })
			},
		}

	}
</script>

<style lang="scss">
	
	.backg{
		background-color: #fff !important;
		transition: .5s
	
	}
	@import './index.scss';
</style>
